/*
 * @Author: Setsuna
 * @Email: 601890383@qq.com
 * @FilePath: \src\pages\CustomerManage\RightsAndInterests\component\ImportRecordDetail.tsx
 * @Date: 2021-12-09 14:35:23
 * @LastEditTime: 2022-01-04 16:02:51
 */
import React from 'react'
import { http, UdForm, validators } from '@/lib'
import { Select, Spin, message, Modal, Button, Input, Timeline, Row } from 'antd'
import apis from '@/apis/CustomerManage'
import ProcessList from '@/components/ProcessList/index'
import { WithToolbar } from '@components/PhotoView'
const { Option } = Select
const { TextArea } = Input
export default class ImportRecordDetail extends React.Component<any> {
  private labelCol: any = { span: 2 }
  private recordDetailForm: any

  state = {
    loading: false,
    recordDetail: {},
  }
  render() {
    let items = [
      { id: 'brandName', label: '品牌公司', render: <Input readOnly /> },
      { id: 'appraiseYear', label: '评价年份', render: <Input readOnly /> },
      { id: 'remarks', label: '备注信息', render: <TextArea rows={3} readOnly /> },
      {
        id: 'file',
        label: '附件',
        render: (
          <>
            <WithToolbar
              imagesList={this.state?.recordDetail?.['quotaApplyDetailFileRespVoList'] || []}
              type="processList"
            />
          </>
        ),
      },
    ]
    return (
      <Spin spinning={this.state.loading}>
        <UdForm
          values={this.state.recordDetail}
          labelCol={this.labelCol}
          getForm={form => (this.recordDetailForm = form)}
          items={items}
        />

        {/* <ProcessList record={this.state.recordDetail} /> */}
      </Spin>
    )
  }

  componentDidMount() {
    let { record } = this.props
    this.getRecordDetail(record.id)
  }

  private getRecordDetail = (id: number | string) => {
    this.setState({ loading: true })
    http
      .get(apis.getImportRecordDetail, { params: { id } })
      .then(res => {
        let { data } = res
        this.setState({ recordDetail: data })
      })
      .finally(() => {
        this.setState({ loading: false })
      })
  }
}
